﻿<%@ Page 
	Title="送信" 
	Language="C#" 
	Inherits="System.Web.Mvc.ViewPage<MvcWebRole1.Models.UserMessagingSendModel>" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>メッセージの送信</title>
</head>
<body>	メッセージの送信
	<%: Model.Message %>
	<% using(Html.BeginForm(null)){ %>
		<%: Html.ValidationSummary(true,"入力内容にエラーがあります。確認して再度入力してください。") %>
		<div>
			<fieldset>
			<legend>送信</legend>
			<div class="editor-label">
				<%: Html.LabelFor(m=>m.Title) %>
			</div>
			<div class="editor-field">
				<%: Html.TextBoxFor(m=>m.Title) %>
				<%: Html.ValidationMessageFor(m=>m.Title) %>
			</div>
			<div class="editor-label">
				<%: Html.LabelFor(m=>m.Content) %>
			</div>
			<div class="editor-field">
				<%: Html.TextAreaFor(m=>m.Content)%>
				<%: Html.ValidationMessageFor(m => m.Content)%>
			</div>
			<div class="editor-label">
				<%: Html.LabelFor(m=>m.Recipents) %>
			</div>
			<div>
				<input type="hidden" name="Recipents" value="<%= Model.Recipents %>" />
				<% if (!string.IsNullOrEmpty(Model.Recipents)) {
				    foreach (var address in Model.Recipents.Split(';')) {%>
					<%:Html.CheckBox("del_" + address)%> <%:address%> <br />
				<%}%>
				<input type="submit" name="delRecipient" value="宛先から削除" />
				<% } %>
			</div>
			<div>
				<p>アドレス帳</p>
				<% if( !string.IsNullOrEmpty( Model.Tag ) ) {%><%:Model.Tag %>タグで抽出中<%}%>
				<% foreach (var address in Model.AddressList) { %>
					<%: Html.CheckBox("adr_"+address.Name, address.Selected )%> <%:address.Name %> <br />
				<% } %>
				<input type="submit" name="addRecipient" value="追加" />
				<% if (Model.AddressBookPageNum != 1){%>
				<input type="submit" name="prevPageAddr" value="前ページ" />
				<%}%>
				<% if (Model.AddressBookPageNum != Model.AddressBookMaxPage){%>
				<input type="submit" name="nextPageAddr" value="次ページ" />
				<%}%>

				<%: Html.ListBoxFor( m=>m.SelectTag, 
	                                 Model.AddressBookTagList
									      .Select( t=> new SelectListItem{ Text=t.Name+"("+t.Count+")" , Value = t.Name}) ) %>
				<input type="submit" name="tagSelect" value="タグ抽出"/>
			</div>
			<p>
				<input type="submit" name="send" value="送信"/>
			</p>

			</fieldset>
		</div>
	<% } %>
</body>
</html>
